package jtk.project4.fleet.field;

import java.text.SimpleDateFormat;

import javax.swing.SortOrder;

import nl.coderight.jazz.form.FormLayout;
import nl.coderight.jazz.form.FormLayout.Resize;
import nl.coderight.jazz.form.field.ComboField;
import nl.coderight.jazz.form.field.MemoField;
import nl.coderight.jazz.form.field.TableField;
import nl.coderight.jazz.form.field.TextField;
import nl.coderight.jazz.form.field.TableField.AutoResizeMode;
import nl.coderight.jazz.form.control.CalendarControl;
import nl.coderight.jazz.form.control.GroupControl;
import jtk.project4.fleet.domain.Equipment;

public class PreventiveMaintenanceDueTableField extends GroupControl<Equipment>{
	
	private TableField<Equipment> preventiveMaintenanceDueTable;
	
	public PreventiveMaintenanceDueTableField(String bindID){
		setBindID(bindID);
		createFields();
		createLayout();
	}
	
	private void createFields() {
		// TODO Auto-generated method stub
		preventiveMaintenanceDueTable = new TableField<Equipment>("preventiveMaintenanceDue","preventiveMaintenanceDue");
		preventiveMaintenanceDueTable.setAutoResizeMode(AutoResizeMode.OFF);
		preventiveMaintenanceDueTable.getSelectionValues();
		
		//add columns
		preventiveMaintenanceDueTable.addColumn("label.pm","PM Service Name");
		preventiveMaintenanceDueTable.addColumn("label.type","Type");
		preventiveMaintenanceDueTable.addColumn("label.date","Date");
		preventiveMaintenanceDueTable.addColumn("label.mileage","Mileage");
		preventiveMaintenanceDueTable.addColumn("label.date","Date");
		preventiveMaintenanceDueTable.addColumn("label.mileage","Mileage");
		preventiveMaintenanceDueTable.addColumn("label.date","Date");
		preventiveMaintenanceDueTable.addColumn("label.mileage","Mileage");
		//Sort
		preventiveMaintenanceDueTable.sort("Date", SortOrder.ASCENDING);
	}
	
	private void createLayout() {
		// TODO Auto-generated method stub
		setLayout(new FormLayout())

		.addField(preventiveMaintenanceDueTable,Resize.HORIZONTAL)
		;	
	}
}
